<template>
  <PageBox :data="dataInfo" @searchBtn="getTbody" :maring="maring" :isRadio="isRadio" :isCheckbox="isCheckbox"
    @tableCheckboxBtn="tableCheckboxBtn" @tableRadioBtn="tableRadioBtn">

    <template #productTakeStockState="{ row }">
      <ElTagBox :data="row.productTakeStockState" :options="options.state" />
    </template>
  </PageBox>
</template>
<script setup lang="ts">
const { proxy } = getCurrentInstance() as any;
import './pageCss.scss'; // 引入样式
import { useListComponent } from './pageTs'; // 引入逻辑
const props = withDefaults(
  defineProps<{
    isRadio?: boolean; //单选
    isCheckbox?: boolean; //多选
    maring?: number; //间距
    query?: any; //
  }>(),
  {
  },
);
const emit = defineEmits<{
  //fn为父组件引入子组件是定义的子组件事件属性，可随意定义
  (event: 'tableRadioBtn', row: any): void;
  (event: 'tableCheckboxBtn', arr: any): void;
}>();
//多选数据
const tableCheckboxBtn = (arr: any) => {
  emit('tableCheckboxBtn', arr);
};
//单选数据
const tableRadioBtn = (row: any) => {
  emit('tableRadioBtn', row);
};
//获取仓库
const getWarehouse = () => {
  proxy.$api.Warehouse.GetMatchWarehouses()
    .then((res: any) => {
      dataInfo.warehouseCode = res[0].warehouseCode;
      getTbody();
    })
    .catch(() => { });
};
// 组件挂载后执行
onMounted(() => {
  getWarehouse()
});
const { dataInfo, getTbody, options } = useListComponent(props);
</script>
